<%@i = 0%>

<div id="region_main">
	<h2>Welcome to the Art of the <%= @region.name %> region!</h2>
	<div id="main_text_and_flicker" class="col2">
		<div class="left">
      		<script type="text/javascript">
                var languages = [];                
                <% for lang in @desc_languages %>
                  languages[<%= lang.id%>] = "<%= lang.description %>"
                <% end %>
              </script>
              
         	<div class="about_art">          
				<% if @desc_languages.length > 1 %>
               		<div style="float:right">
                  		Language: <%= render :partial => 'shared/description_select', :object => @desc_languages, :locals => {:value_method => :id, :text_method => :language, :selected => @desc_languages.first.id, :update => 'localized_description'} %>
                	</div>
             	<% end %>
             	<p class="title">About this region</p>
         	</div>
              
         	<div id="localized_description">
            	<%= @desc_languages.first.description %>
         	</div>              
		</div>

		<div class="right">
			<% if @region.medias.size > 0%>
				<div class="flicker" align="center">
					<% @images = Array.new(@region.medias.size - 1) %>
					<% i = 0 %>
					<% for @media in @region.medias %>
						<% if @media.is_a? Picture%>
							<% @images[i] = '/picture/file/' + @media.file_relative_path(subdir="medium") %>
							<% i = i +1 %>
						<%end%>
					<% end %>
	
					<img src=""id="thisImageContainer"/>
					<br/>
					<a href="#" id="thisLeftButton">&laquo;</a>
					<span id="thisTextContainer"></span>
					<a href="#" id="thisRightButton">&raquo;</a>
					<script>new ImageFlicker("thisLeftButton", "thisRightButton", "thisImageContainer", "thisTextContainer", <%= @images.to_json %>) </script>
				</div>
			<% end %>
		</div>
	</div>	
	
	<div class="col2">
		<div id="artist_title" align ="center"><h2>Artists in <%= @region.name%></h2></div>
		<span class = "arrow_container">
			<div id="left_arrow" href="javascript:void(0);" ><%= image_tag 'left.png' %></div>
		</span>
		<div id="imageBox">
  			<div id="imageBoxInside">
  				<% @pictures = Array.new %>
				<% for artist in @region.artists %>
					<% pic = Picture.find_by_artist_id(artist.id) %>
					<% if !pic.nil?%>
						<% @pictures.push(pic) %>										
					<%end%>
				<%end%>
  				<%for pic in @pictures %>
					<a class="scroll_enclose" href="/artists/show/<%=pic.artist_id%>">
					<div class="thumbnail_artist_scroll">
  						<%= image_tag url_for_file_column(pic, "file", "hundred")  %>
					</div>
					<p>
						<%= pic.artist.name %>
					</p>
					</a>	
				<%end%>
			</div>
		</div>
			<span class = "arrow_container">
				<div id="right_arrow" href="javascript:void(0);"><%= image_tag 'right.png' %></div>
			</span>
			<script> new ArtistScroller("left_arrow","right_arrow", <%= @pictures.size.to_json %>)</script>
	</div>
			
	<div id="lists">
		<div class="col2">	
			<div id="other_items" class="left">
				<%= render :partial => '/artworks/show_summaries', :locals => {:name => Region.l_attr("art"), :artworks => @region_art[:random]} %>
			</div>
			<div id="new_artwork" class="right">
				<%= render :partial => '/artworks/show_summaries', :locals => {:name => l(:common, 'new artwork'), :artworks => @region_art[:new]} %>
			</div>
		</div>
	</div>
</div>